package edu.zut.hb.software.chat.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.zut.hb.software.base.domain.BaseTreeEntity;
import lombok.Data;

@Table(name = "C_chatGroup")
@Entity
@Data
@NamedQueries({ @NamedQuery(name = "ChatGroup.getRoot", query = "select g from ChatGroup g where g.parent is null")})
public class ChatGroup extends BaseTreeEntity<ChatGroup, Long>{
	
    /**
	 * 
	 */
	private static final long serialVersionUID = -1426709032158154410L;

	@Column(name = "chatnums")
    private String chatnums;//组内chat数量

    @Column(name = "phone")
    private String phone;//负责人电话
    
    @OneToMany(mappedBy = "group", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	Set<Chat> chat;

	public String getChatnums() {
		return chatnums;
	}

	public void setChatnums(String chatnums) {
		this.chatnums = chatnums;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

//    @OneToMany(mappedBy = "hospital", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
//    Set<Department> departments;

}
